package parallel;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableUtils;
import org.apache.hadoop.mapreduce.InputSplit;

public class BasicRangeInputSplit extends InputSplit implements Writable{
    long sequenceCount;
    int splitId;
    public BasicRangeInputSplit() { }

    public BasicRangeInputSplit(long length, int id) {
            sequenceCount = length;
            splitId = id;
    }

    public long getLength() throws IOException {
            return 0;
    }
    public long getSequenceCount()
    {
            return sequenceCount;
    }
    public int getSplitId()
    {
            return splitId;
    }
    public String[] getLocations() throws IOException {
            return new String[]{};
    }

    public void readFields(DataInput in) throws IOException {
            sequenceCount = WritableUtils.readVLong(in);
            splitId = WritableUtils.readVInt(in);
    }

    public void write(DataOutput out) throws IOException {
            WritableUtils.writeVLong(out, sequenceCount);
            WritableUtils.writeVInt(out, splitId);
    }

}
